my $eng_directory = "/home/naila/Naila_Thesis/corpus/quran/yusuf_lahori/eng";
my $urdu_directory = "/home/naila/Naila_Thesis/corpus/quran/yusuf_lahori/urdu";
my $hunalign = "/home/naila/Naila_Thesis/tools/hunalign/src/hunalign/hunalign";
my $dict = "/home/naila/Naila_Thesis/corpus/dictionary/dictionary.txt";
my $hunlog_directory = "/home/naila/Naila_Thesis/corpus/alignments_shortened_corpus/hunlog/";
my @eng_files = ();
my @urdu_files = ();

opendir(DD, $eng_directory) || die("Cannot open directory");
@eng_files= readdir(DD);
closedir(DD);

opendir(DD, $urdu_directory) || die("Cannot open directory");
@urdu_files= readdir(DD);
closedir(DD);

$dir_to_write = "/home/naila/Naila_Thesis/corpus/alignments_shortened_corpus/";

for $file_name(@eng_files)
{
	$file_name =~ s/_eng.txt//;
}


for(my $i=0;$i< @eng_files;$i++)
{
	$f = $eng_files[$i];
#	print "Reading file   ",$f, "\n";

	unless ( ($f eq ".") || ($f eq "..") || ($f =~ "~"))
	{
		my $file_name_eng = join "",$eng_directory,"/",$f,"_eng.txt";
		my $file_name_urdu  = join "",$urdu_directory,"/",$f,"_urdu.txt";
		my $file_name_write = join "",$dir_to_write,$f,"_align.txt";
		my $file_name_hunlog = join "",$hunlog_directory,$f,".log";
		my $flag = "-text -bisent -utf -realign -cautious";

#		my @args = ($hunalign, $dict, $file_name_eng, $file_name_urdu ,$flag,">", $file_name_write);
#		system(@args);
#		system("$hunalign $flags $dict $usefile[0] $usefile[1] > $hunout 2> $hunlog");
		system("$hunalign $flag $dict $file_name_eng $file_name_urdu > $file_name_write 2>$file_name_hunlog");

	}
}
